package com.sti.framework.models.User.data;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.sti.framework.core.annotation.validation.Dict;
import com.sti.framework.core.data.AbstractAuditingEntity;
import com.sti.framework.core.encryption.aes.converter.StringFStringEncryptConverter;
import com.sti.framework.core.web.CommonConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 用户信息
 *
 * 用户信息
 *
 * @author AutoApi
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "user_user", autoResultMap = true)
@ApiModel(value = "user_user", description = "用户信息")
public class User extends AbstractAuditingEntity {

    
    
	/**
	 * 密码
	 */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	@ApiModelProperty(value = "密码", required = false, example = "123456")
	private String password;

	/**
	 * 用户名
	 */
	@NotBlank(message = "请输入用户名")
	@Size(min = 1,max = 50,message = "用户名长度不符合")
	@ApiModelProperty(value = "用户名", required = true, example = "aarongao")
	private String username;

	/**
	 * 角色
	 */
	@ApiModelProperty(value = "角色", required = true, example = "管理员")
	private String role;


	/**
	 * 角色ID
	 */
	@ApiModelProperty(value = "角色", required = true, example = "2")
	private Long role_id;

	/**
	 * 姓名
	 */
	@NotBlank(message = "请输入姓名")
	@Size(min = 1,max = 10,message = "姓名长度不符合")
	@ApiModelProperty(value = "姓名", required = true, example = "王沐瑶")
	private String realNamer;

	/**
	 * 生日
	 */

	@JsonFormat(pattern = CommonConstants.DATE_FORMAT_L_STR)
	@DateTimeFormat(pattern = CommonConstants.DATE_FORMAT_L_STR)
	@ApiModelProperty(value = "生日", required = false, example = "2021-09-17")
	private LocalDate birthday;

	/**
	 * 学历
	 */
	@Dict(dict="UserEducation", message = "学历不在可选范围")
	@ApiModelProperty(value = "学历", required = false, example = "博士后")
	private String education;

	/**
	 * 身份证
	 */
	@TableField(value = "idCard", typeHandler = StringFStringEncryptConverter.class )
	@ApiModelProperty(value = "身份证", required = false, example = "210211198302222222")
	private String idCard;

	/**
	 * 性别
	 */
	@Dict(dict="Sex", message = "性别不在可选范围")
	@ApiModelProperty(value = "性别", required = false, example = "女")
	private String sex;

	/**
	 * 手机号码
	 */
	private String phone;



    /** Token */
    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    private String token;
	/**
	 * 验证码
	 */
	@TableField(exist = false)
    private String code;

	/**
	 * 二次密码
	 */
	@TableField(exist = false)
	private String verifyPassword;
	/**
	 * 是否为忘记密码
	 */
	@TableField(exist = false)
	private String isUpdatePass;

	/**
	 * 小秘书号
	 */
	private String appIdCode;

	/**
	 * 头像
	 */
	private String headImg;

	/**
	 * 原云盘容量（字节）
	 */
	private BigDecimal store;

	/**
	 * 剩余云盘容量（字节）
	 */
	private BigDecimal residueStore;

	/**
	 * 已使用容量
	 */
	@TableField(exist = false)
	private BigDecimal usedStore;
	/**
	 * 单位
	 */
	@TableField(exist = false)
	private String unitStr;

	/**
	 * 查看量
	 */
	private Integer showCount;
	/**
	 * 收藏量
	 */
	private Integer likeCount;

	private String openId;
	private String isWeChat;

	/**
	 * 是否执行密码重新进行md5加密
	 */
	@TableField(exist = false)
	private String isEncipherFlag;

}
